package net.wsfcp.android.http.mvp.transformer;


import net.wsfcp.android.base.BaseHttpResult;

import org.reactivestreams.Publisher;

import io.reactivex.Flowable;
import io.reactivex.FlowableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;


/**
 * Created by shaoboyang on 2016/11/6.
 */

public class CommonTransformer<T> implements FlowableTransformer<BaseHttpResult<T>, T> {
    @Override
    public Publisher<T> apply(Flowable<BaseHttpResult<T>> upstream) {
        return upstream
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .compose(ErrorTransformer.getInstance());
    }

}

